#include <iostream>
#include <map>
#include <vector>

using namespace std;

class Solution {
public:
  int removeDuplicates(vector<int> &nums) {
    int ne_num = 0;
    int eq_num = 0;
    int raw_sz = nums.size();
    map<int, bool> m;

    for (int i = 0; i < raw_sz; i++) {
      map<int, bool>::iterator fd = m.find(nums[i]);
      if (fd != m.end()) {
        eq_num++;
      } else {
        ne_num++;
        nums[i - eq_num] = nums[i];
      }
      m.insert(map<int, bool>::value_type(nums[i], true));
    }

    return ne_num;
  }
};

int main() { return 0; }
